﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LightSO.Library.Common
{
    public static class ClassHelper
    {
        private static dynamic _instance;
        private static readonly object syslock = new object();

        public static T Singleton<T>() where T:class, new()
        {
            if (_instance == null)
            {
                lock (syslock)
                {
                    if (_instance == null)
                    {
                        _instance = new T();
                    }
                }
            }
            return _instance;
        }
    }
}
